<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客-登录</title>
    <link rel="stylesheet" href="boke.css">
    <script src="boke.js"></script>
</head>
<body>
    <div class="box"> 
        <h3 class="head">博客登录</h3>
            <div>
                <label for="user">账号：</label>
                <input type="text" id="user" name="user" required>
            </div>
            <div>
                <label for="password">密码：</label>
                <input type="password" id="password" name="password" required>
            </div>
            <button id="but" onclick="handleClick()">登录</button>
            <!-- <button id="but1" class="but1">录入</button> -->
    <script>
       const handleClick = () => {
            const user = document.getElementById('user');
            const password = document.getElementById('password');
            if (user.value === 'admin' && password.value === '123') {
                alert('登录成功');
                window.location.href = "http://47.116.207.219/homePage";//跳转页面
            } else {
                password.value = '';
                alert('账号或密码错误')
            }
        }
        // but1.addEventListener('click', () => {
        //         const user = document.getElementById('user');
        //         user.value = 'admin';
        //         const password = document.getElementById('password');
        //         password.value = '123';
        //     }) 
    </script>
</body>
</html>